package com.wyp168.jse.face.question;

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

/**
 * @ClassName BigNumberCompute
 * @Title TODO
 * @Description TODO
 * @Author wyp168
 * @Date 2023/3/1 20:41
 */
public class BigNumberCompute {

    public static void main(String[] args) {
        BigNumberCompute bigNumberCompute = new BigNumberCompute();
        System.out.println(bigNumberCompute.val.doubleValue());
        System.out.println(bigNumberCompute.plus(111111D));
        System.out.println(bigNumberCompute.divide(11D));
        System.out.println(bigNumberCompute.multi(1111111111D));
        System.out.println(bigNumberCompute.reduce(1111111111D));
    }

    BigDecimal val = new BigDecimal("1000000000");



    public Double plus(Double val) {
        return this.val.add(new BigDecimal(val)).doubleValue();
    }

    public Double reduce(Double val) {
        return this.val.subtract(new BigDecimal(val)).doubleValue();
    }

    public Double multi(Double val) {
        return this.val.multiply(new BigDecimal(val)).doubleValue();
    }

    public Double divide(Double val) {
        return this.val.divide(new BigDecimal(val), MathContext.UNLIMITED).doubleValue();
    }

}
